/**
 * 写消息
 * @param xxlx 消息类型：101 全站通知；102用户交流；
 * @param jsruserid 接收人
 */
function writeMsg(xxlx, jsruserid){
	var uri ;
	if(xxlx && xxlx.length>0){
		uri = "../system/message-input.action?tsysMessage.xxlx="+xxlx;
	}else{
		uri = "../system/message-input.action?tsysMessage.xxlx=102";
	}
	if(jsruserid && jsruserid.length>0){
		uri += "&tsysMessage.xxjsr="+jsruserid;
	}
	openWindow(uri);
}

/**
 * 发送草稿箱的消息
 * @param ids
 */
function sendDraftMsg(ids){
	//ajaxService.sendShortMessage(ids, ajaxBackString);
	var url = "";
	$.post(url, {wid:ids}, ajaxBackString);
	function ajaxBackString(result){
		if(result){
			alert('发送成功');
		}
		document.forms[0].submit();
	}
	
}

function readMsg(msgId, receiverWid, isChangeMsgState){
	var title = $('#msg_title'+msgId).html();
	if(title!=""){
		title = "<span style='font-size:11px;color:#000'>" + title + "</span>";
	}
	showInfo( $('#msg'+msgId).html(), title );
	if (isChangeMsgState) {
		changeMsgState(msgId, receiverWid)
	}
}

function changeMsgState(msgId, receiverWid){
	var url = "../system/message-changeState.action";
	$.get(url, {wid: receiverWid}, function(data){
  		if(data=='ok'){
  			//alert("已读");
  			$("#msg_title"+msgId).css("font-weight","normal");
  		}
  	})
}

/**
 * 回复消息
 * @param jsr
 * @param msgId
 */
function replyMsg(jsr, msgId, receiveWid){
	var uri = "message-input.action?action=replyMsg&tsysMessage.xxlx=102&tsysMessage.xxjsr="+jsr;//102用户交流
	openWindow(uri);
	changeMsgState(msgId, receiveWid);
}

function submitRemove(ids, scr){
	var url = actionName + "-remove."+uri_suffix;
	var conf = window.confirm("您确定要删除已选中的这些数据吗？");
	if(conf==true){
			if(ids.length>0){
				$.post(url,
				       { wid: ids, scr: scr, reqtime: (new Date()).getTime() },
				       function(data){
						if(data.indexOf("删除成功")!=-1){
							document.forms[0].submit();
						}else{
					    	alert(data);
						}
				       }
				);
			}else{
				alert("请选择要删除的项!");
			}
	}
}	
